import 'package:flutter/material.dart';
import 'package:flutter_shop/model/details.dart';
import '../service/service_method.dart';
import 'dart:convert';

class DetailsInfoProvide  with ChangeNotifier{

  DetailsModel detailsModel=null;

  bool isLeft=true;
  bool isRight=false;

  //从后台获取数据

  getGoodsInfo(String id) async{
    var formData = { 'goodId':id, };
    await request('getGoodDetailById',formData:formData).then((val){
      var responseData= json.decode(val.toString());
      detailsModel=DetailsModel.fromJson(responseData);
      notifyListeners();
    });

  }

  changeLeftAndRight(String changeState){

    if(changeState=='left'){
      isLeft=true;
      isRight=false;
    }else{
      isLeft=false;
      isRight=true;
    }
    notifyListeners();
  }

}